<template>
	<view class="container">
		<!-- 头部 -->
		<view class="top">
			<view class="home" @click="back">
				<image src="../../static/assets/home.png" mode=""></image>
			</view>
			<view class="city">北京</view>
			<view class="title">找室友专区</view>
		</view>
		<!-- 下拉列表 -->
		<!-- <dropdown></dropdown> -->
		<!-- 房源列表 -->
		<view class="roommatelist">
			<block v-for="item in roommateList" v-bind:key="item.topic_id">
				<navigator class="item" :url="'../roommateDetail/roommateDetail?topicid='+encodeURIComponent(item.topic_id)">
					<view class="houseimg">
						<image :src="item.photo1" mode=""></image>
					</view>
					<view class="content">
						<view class="price">￥{{item.rent_amount}}</view>
						<view class="title">
							{{item.address}}
						</view>
						<view class="taglist">
							<view class="tagitem">{{item.room_type}}</view>
							<view class="tagitem">{{item.roommate_req}}</view>
							<view class="tagitem">{{item.checkin_date}}入住</view>
						</view>
						<view class="subway">{{item.near_subway_desc}}</view>
						<view class="refresh">{{item.refresh_time}}</view>
					</view>
				</navigator>
			</block>
		</view>
	</view>
</template>

<script>
	import dropdown from "../../components/ren-dropdown-filter/ren-dropdown-filter.vue"
	import {roommateList} from "../../data/roommate.js"
	export default {
		data() {
			return {
				roommateList:[]
			}
		},
		components:{
			dropdown
		},
		methods: {
			back(){
				uni.switchTab({
					url:"../index/index"
				})
			}
		},
		onLoad(){
			let list=roommateList.result.list.result.list;
			// console.log(list)
			this.roommateList=list
		}
	}
</script>

<style lang="scss">
.container{
	width: 100%;
	height: 100%;
	// 头部栏
	.top{
		width: 100%;
		height: 150rpx;
		display: flex;
		align-items: center;
		color: #FFFFFF;
		background-color: #585eaa;
		.home{
			width: 80rpx;
			height: 80rpx;
			margin-left: 20rpx;
			image{
				width: 100%;
				height: 100%;
			}
		}
		.city{
			padding: 0 30rpx;
			font-size: 18px;
		}
		.title{
			padding: 0 20rpx;
			font-size: 18px;
			font-weight: bold;
			margin-left: 60rpx;
		}
	}
	//房源列表
	.roommatelist{
		width: 95%;
		margin: 0 auto;
		margin-top: 50rpx;
		display: flex;
		flex-direction: column;
		.item{
			width: 100%;
			height: 250rpx;
			margin-top: 12rpx;
			border-bottom: 1px solid #ddd;
			display: flex;
			align-items: center;
			justify-content: space-between;
			.houseimg{
				width: 40%;
				height:200rpx;
				image{
					width: 100%;
					height: 100%;
				}
			}
			.content{
				width:55%;
				height:200rpx;
				position: relative;
				.price{
					padding: 5rpx 8rpx;
					position: absolute;
					top: 2%;
					right: 2%;
					color: #585eaa;
					font-size: 18px;
					font-weight: bold;
				}
				.title{
					width: 60%;
					overflow: hidden;
					text-overflow: ellipsis;
					white-space: nowrap;
					margin-top: 2%;
					font-size: 18px;
					font-weight: bold;
					color: #555555;
				}
				.taglist{
					width: 100%;
					display: flex;
					align-items: center;
					margin-top: 6rpx;
					.tagitem{
						padding: 5rpx 8rpx;
						background-color: #C0C0C0;
						color: #FFFFFF;
						border-radius: 8rpx;
						font-size: 12px;
						margin-right: 5rpx;
					}
				}
				.subway{
					margin-top: 6rpx;
					color: #808080;
				}
				.refresh{
					position: absolute;
					bottom: 1%;
					right: 3%;
					color: #C8C7CC;
					font-size: 14px;
				}
			}
		}
	}
}
</style>
